/**
 * 游戏配置文件
 */
const CONFIG = {
    // 游戏基础设置
    GAME_SPEED: {
        PAUSED: 0,
        SLOW: 1000, // 1年/秒
        MEDIUM: 100, // 10年/秒
        FAST: 10 // 100年/秒
    },
    
    // 地图设置
    MAP: {
        WIDTH: 1000,
        HEIGHT: 800,
        MAX_KINGDOM_RADIUS: 100, // 王国最大半径
        TERRAIN_TYPES: {
            PLAINS: { name: "平原", color: "#a8c66c", probability: 0.4, effects: { population: 0.1, military: 0, resources: 0 } },
            MOUNTAINS: { name: "山地", color: "#8b7355", probability: 0.25, effects: { population: 0, military: 0.15, resources: 0 } },
            FOREST: { name: "森林", color: "#2e8b57", probability: 0.2, effects: { population: 0, military: 0, resources: 0.2 } },
            DESERT: { name: "荒漠", color: "#e6c34c", probability: 0.15, effects: { population: -0.05, military: -0.05, resources: -0.05 } }
        },
        RESOURCE_DENSITY: 0.01, // 每100格1个资源点
        DANGER_DENSITY: 0.005 // 每200格1个危险区域
    },
    
    // 种族设置
    RACES: [
        { 
            id: 1, 
            name: "精灵族", 
            trait: "敏捷+20%，人口增长-10%", 
            effects: { 
                agility: 0.2, 
                populationGrowth: -0.1, 
                resourceGathering: 0, 
                militaryPower: 0 
            },
            npcAbilityRange: [80, 150],
            color: "#7fffd4"
        },
        { 
            id: 2, 
            name: "兽人族", 
            trait: "力量+15%，人口增长+20%", 
            effects: { 
                strength: 0.15, 
                populationGrowth: 0.2, 
                resourceGathering: 0, 
                militaryPower: 0 
            },
            npcAbilityRange: [60, 130],
            legendaryChance: 0.01, // 1%概率生成传说级NPC
            legendaryAbilityRange: [200, 300],
            color: "#8b4513"
        },
        { 
            id: 3, 
            name: "矮人族", 
            trait: "防御+25%，资源采集+10%", 
            effects: { 
                defense: 0.25, 
                populationGrowth: 0, 
                resourceGathering: 0.1, 
                militaryPower: 0 
            },
            npcAbilityRange: [70, 140],
            color: "#cd853f"
        },
        { 
            id: 4, 
            name: "人族", 
            trait: "平衡发展，无增减益", 
            effects: { 
                balance: 0.05, 
                populationGrowth: 0, 
                resourceGathering: 0, 
                militaryPower: 0 
            },
            npcAbilityRange: [75, 145],
            color: "#f5deb3"
        },
        { 
            id: 5, 
            name: "亡灵族", 
            trait: "人口无自然增长，但死亡率-50%", 
            effects: { 
                populationGrowth: -0.05, 
                deathRate: -0.5, 
                resourceGathering: 0, 
                militaryPower: 0.05 
            },
            npcAbilityRange: [65, 135],
            color: "#9370db"
        },
        { 
            id: 6, 
            name: "龙裔族", 
            trait: "军事力量+20%，资源消耗+15%", 
            effects: { 
                populationGrowth: 0, 
                resourceGathering: -0.15, 
                militaryPower: 0.2 
            },
            npcAbilityRange: [85, 155],
            color: "#dc143c"
        },
        { 
            id: 7, 
            name: "海族", 
            trait: "水域适应+30%，陆地适应-10%", 
            effects: { 
                waterAdaptation: 0.3, 
                landAdaptation: -0.1, 
                populationGrowth: 0.05, 
                militaryPower: 0 
            },
            npcAbilityRange: [75, 140],
            color: "#4682b4"
        },
        { 
            id: 8, 
            name: "机械族", 
            trait: "资源采集+25%，人口增长-20%", 
            effects: { 
                populationGrowth: -0.2, 
                resourceGathering: 0.25, 
                militaryPower: 0.1 
            },
            npcAbilityRange: [90, 160],
            color: "#708090"
        },
        { 
            id: 9, 
            name: "元素族", 
            trait: "环境适应+20%，人口增长-5%", 
            effects: { 
                environmentAdaptation: 0.2, 
                populationGrowth: -0.05, 
                resourceGathering: 0.1, 
                militaryPower: 0 
            },
            npcAbilityRange: [80, 150],
            color: "#9acd32"
        },
        { 
            id: 10, 
            name: "虫族", 
            trait: "人口增长+30%，单体能力-10%", 
            effects: { 
                populationGrowth: 0.3, 
                individualAbility: -0.1, 
                resourceGathering: 0, 
                militaryPower: 0 
            },
            npcAbilityRange: [50, 120],
            color: "#556b2f"
        }
    ],
    
    // 王国发展参数
    KINGDOM: {
        INITIAL_POPULATION: {
            MIN: 400,
            MAX: 600
        },
        BASE_GROWTH_RATE: 0.05, // 基础人口增长率5%
        RESOURCE_GENERATION: {
            PER_POPULATION: 0.8,
            PER_RESOURCE_POINT: 50
        },
        MILITARY_GENERATION: {
            PER_POPULATION: 0.5,
            PER_HERO: 10
        }
    },
    
    // NPC生成参数
    NPC: {
        GENERATION_RATE: 100, // 每100人口生成1个NPC
        DEATH_CHANCE: 0.02, // 每年2%概率死亡
        MAX_AGE: 80 // 最大年龄
    },
    
    // 事件参数
    EVENTS: {
        CHANCE_PER_YEAR: 0.1, // 每年10%概率触发随机事件
        TYPES: {
            POSITIVE: 0.4, // 40%概率为正面事件
            NEUTRAL: 0.3, // 30%概率为中性事件
            NEGATIVE: 0.3 // 30%概率为负面事件
        }
    },
    
    // 魔王挑战参数
    BOSS: {
        FIRST_ATTACK: 100, // 第一次魔王袭击年份
        POWER_MULTIPLIER: 1.5, // 魔王能力值倍数
        PLANE_DIFFICULTY: 1000, // 每个位面增加的难度
        WARNING_YEARS: 10 // 提前10年开始警告
    },
    
    // 存档设置
    SAVE: {
        AUTO_SAVE_INTERVAL: 5 * 60 * 1000, // 5分钟自动存档一次
        MAX_MANUAL_SAVES: 5 // 最多5个手动存档
    }
};